Here, we execute 100 coroutines in a loop.

If we were forking threads for each of these coroutines, this would be expensive in terms of memory and CPU time. However, the threads are determined by the Dispatcher, not the coroutine itself. While we have 100 coroutines, we have one Dispatcher, and it happens to have one thread. So, all 100 coroutines will run on one thread, switching between the coroutines when Kotlin encounters a suspend function.

You can learn more about this in:
Tags:
Run Edit